package test0102;

public class Library {
    String name;
    Book[] arr = new Book[3];
    int i =0;

    public Library() {
    }

    public Library(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Library{" +
                "name='" + name + '\'' +
                '}';
    }

    public void add(Book book) {
        arr[i] = book;
        i++;
    }

    public void printAll() {
        for (Book book : arr) {
            System.out.println(book);
        }
    }

    public Book findBookByAuthor(String name) {
        Book book =null;
        for (Book book1 : arr) {
            if (book1.getSname() == name){
                book = book1;
            }
        }
        return book;
    }

    public Book[] findBorrowedBook() {
        Book[] brr = new Book[3];
        int o = 0;
        for (Book book : arr) {
            if (book.zt){
                brr[o] = book;
                o++;
            }
        }
        return brr;
    }
}
